Get User Profile
User Management
Get User Profile
Retrieve the authenticated user profile information
POST
Get User Profile
Overview
This endpoint returns the profile information for the currently authenticated user. Authentication is required via JWT token.Authentication
This endpoint requires authentication. Include a valid JWT access token in the Authorization header:Request
Endpoint
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer | Yes |
| Content-Type | application/json | Yes |
Request Body
No request body required. The user is identified from the authentication token.Response
Success Response (200 OK)
Returns the user profile data serialized usingUsersSerializer:
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique user identifier |
| username | string | User’s username (inherited from AbstractUser) |
| string | User’s email address (unique, max 200 chars) | |
| first_name | string | User’s first name (max 200 chars, optional) |
| last_name | string | User’s last name (max 200 chars, optional) |
| number_phone | string | User’s phone number (max 10 chars, optional) |
| avatar | string | URL path to user’s avatar image (optional) |
| date_joined | datetime | When the user account was created |
| last_login | datetime | Last login timestamp |
| is_active | boolean | Whether the user account is active |
| is_staff | boolean | Whether user has staff privileges |
| is_superuser | boolean | Whether user has superuser privileges |
Error Responses
401 Unauthorized
Returned when the authentication token is missing or invalid:404 Not Found
Returned when the authenticated user cannot be found in the database:500 Internal Server Error
Returned when an unexpected error occurs:Example Request
Example Response
Implementation Details
This endpoint is implemented in/apps/users/views.py:84 as the profile function view:
- Decorated with
@permission_classes([IsAuthenticated])to require authentication - Uses
UsersSerializerto serialize the user data fromrequest.user - Returns all fields from the Users model (which extends Django’s AbstractUser)
Related Endpoints
- Update Profile - Update user profile information
- Delete User - Delete user account
